package es.ats.codington.festival.utils;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

public class JSonQuery {

	
	 Object obj;
	 JSONObject jsonObject;
	
	
	/**
	 *  Constructor
	 */
	 public JSonQuery() {
		openJson();
		 
	}
   
	 /**
	  * Open Json
	  */
	 public void openJson() {
			JSONParser parser=new JSONParser();
			 try {
				obj = parser.parse(new FileReader("src\\es\\ats\\codington\\festival\\json\\JSonQueryDB.json"));
				jsonObject = (JSONObject) obj;
			 } catch (FileNotFoundException e) {
				
				e.printStackTrace();
			} catch (IOException e) {
				
				e.printStackTrace();
			} catch (ParseException e) {
				e.printStackTrace();
			} 
		}
	 
	 //-------------------- Getters of Event Queries ----------------------
	 
	public String getShowEvents (){
		String showEvents = (String) jsonObject.get("showEvents");
	 return showEvents;	 
	 }
	
	public String getRegisterNewEvent (){
		String registerNewEvent = (String) jsonObject.get("registerNewEvent");
	 return registerNewEvent;	 
	 }
	
	public String getDeleteEvent (){
		String deleteEvent = (String) jsonObject.get("deleteEvent");
	 return deleteEvent;	 
	 }
	
	public String getUpdateEvent (){
		String updateEvent = (String) jsonObject.get("updateEvent");
	 return updateEvent;	 
	 }
	
	public String getCheckEvent (){
		String checkEvent = (String) jsonObject.get("checkEvent");
	 return checkEvent;	 
	 }
	
	public String getGetIdEvent (){
		String getIdEvent = (String) jsonObject.get("getIdEvent");
	 return getIdEvent;	 
	 }
	
	//-------------------- Getters of Visitor Queries ----------------------
	
	public String getRegisterNewPeople (){
		String registerNewPeople = (String) jsonObject.get("registerNewPeople");
	 return registerNewPeople;
	}
	
	public String getRegisterNewVisitor (){
		String registerNewVisitor = (String) jsonObject.get("registerNewVisitor");
	 return registerNewVisitor;
	}
	
	public String getUpdatePeople (){
		String updatePeople = (String) jsonObject.get("updatePeople");
	 return updatePeople;
	}
	
	public String getUpdateVisitor (){
		String updateVisitor = (String) jsonObject.get("updateVisitor");
	 return updateVisitor;
	}
	
	public String getGetIdVisitor (){
		String getIdVisitor = (String) jsonObject.get("getIdVisitor");
	 return getIdVisitor;
	}
	
	public String getLoginVisitor (){
		String loginVisitor = (String) jsonObject.get("loginVisitor");
	 return loginVisitor;
	}
	
	public String getIsAdmin (){
		String isAdmin = (String) jsonObject.get("isAdmin");
	 return isAdmin;
	}
	
	//-------------------- Getters of EventSingUp Queries ----------------------
	
	
	public String getregVisForEvent (){
		String loginVisitor = (String) jsonObject.get("regVisForEvent");
	 return loginVisitor;
	 }
	
	
	public String getcheckEventsofVisitor(){
		String loginVisitor = (String) jsonObject.get("checkEventsofVisitor");
	 return loginVisitor;
	 }
	
	public String getunregisterVisitorForEvent(){
		String loginVisitor = (String) jsonObject.get("unregisterVisitorForEvent");
	 return loginVisitor;
	 }
	
	public String getviewEventsOfUser(){
		String loginVisitor = (String) jsonObject.get("viewEventsOfUser");
	 return loginVisitor;
	 }
	public String getdeleteVisitor(){
		String loginVisitor = (String) jsonObject.get("deleteVisitor");
	 return loginVisitor;
	 }
	public String getdeletePeople(){
		String loginVisitor = (String) jsonObject.get("deletePeople");
	 return loginVisitor;
	 }
	
}
